﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.Infrastructure;
using DLM.Domain.Model;

namespace DLM.Data.EF.CodeFirst.Mapping
{
    public class OrderMap : EntityTypeConfiguration<Order>
    {
        public OrderMap()
        {
            this.HasKey(t => t.OrderID);
            this.ToTable("Order");
            this.Property(t => t.OrderID).HasColumnName("OrderID").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.Property(t => t.OrderNo).HasColumnName("OrderNo").HasMaxLength(50).IsUnicode(false).IsRequired();
            this.Property(t => t.TradeNo).HasColumnName("TradeNo").HasMaxLength(50).IsUnicode(false).IsRequired();
            this.Property(t => t.Price).HasColumnName("Price").IsRequired();
            this.Property(t => t.Subject).HasColumnName("Subject").HasMaxLength(30).IsUnicode(true);
            this.Property(t => t.Body).HasColumnName("Body").HasMaxLength(50).IsUnicode(true);
            this.Property(t => t.BuyerEmail).HasColumnName("BuyerEmail").HasMaxLength(50).IsUnicode(true);
            this.Property(t => t.TradeStatus).HasColumnName("TradeStatus").HasMaxLength(30).IsUnicode(false);
            this.Property(t => t.IsConfirmed).HasColumnName("IsConfirmed");
            this.Property(t => t.OrderDate).HasColumnName("OrderDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
            this.Property(t => t.UserID).HasColumnName("UserID");

        }
    }
}
